<template>
        <div class="app2">
            子组件2
            <h4>{{toy}}</h4>
            <h4>父给的车：{{ car }}</h4>
            <button @click="sendToy(toy)">把玩具交给父</button>
        </div>
</template>
    
<script setup lang='ts'>
import { ref } from 'vue';

let toy = ref('奥特曼')

// 接收父传过来的数据
defineProps(['car', 'sendToy'])

</script>
    
<style scoped>
    .app2{
        padding: 10px;
        margin: 10px;
        background-color: skyblue;
        border-radius: 5px;
        box-shadow: 0 0 10px ;
    }
</style>